package com.zhuss.product.db.dao.ext;

import java.util.Date;
import java.util.List;
import java.util.Set;

import com.zhuss.bean.unit.product.HotLineResp;
import com.zhuss.bean.vo.product.train.ListLineStrategyVo;


import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import com.zhuss.bean.bo.product.train.SearchTrainBo;
import com.zhuss.bean.unit.order.TrainGroupBean;
import com.zhuss.bean.unit.product.TrainBean;
import com.zhuss.bean.vo.product.train.DetailTrainVo;
import com.zhuss.bean.vo.product.train.ListTrainVo;
import com.zhuss.product.db.dao.gen.TrainMapper;
import com.zhuss.product.db.entity.Train;

/**
 * @description: 车次数据库Dao
 * @author: zhushanshuo
 * @create: Mon Jan 04 08:55:12 CST 2021
 **/

@Mapper
public interface TrainDao extends TrainMapper {

	Integer used(@Param("trainId") Long trainId, @Param("count") Long count, @Param("status") Integer status, @Param("canSell") Integer canSell);

	void unused(@Param("trainList") List<TrainGroupBean> trainList);

	void create(Train record);

	void delete(Train record);

	List<Train> listAll();

	List<DetailTrainVo> listById(@Param("trainIdList") List<Long> trainIdList);

	List<TrainBean> listByIdSell(@Param("lineStrategyId") Long lineStrategyId, @Param("trainIdList") List<Long> trainIdList,
									 @Param("status") Integer status, @Param("canSell") Integer canSell);

	List<Long> listIdById(@Param("trainIdList") List<Long> trainIdList);

	List<Train> listByName(@Param("name") String name);

	List<ListTrainVo> list(SearchTrainBo bo);

	Integer countList(SearchTrainBo bo);

	DetailTrainVo detail(@Param("trainId") Long trainId);

	void insert(@Param("trains") List<Train> trains );

	List<Train> listByStrategy(@Param("lineStrategyId") Long lineStrategyId, @Param("status") Integer status, @Param("canSell") Integer canSell, @Param("now") Date now);

	List<Train> listTrainByLineStrategyId(@Param("lineStrategyId") Long lineStrategyId, @Param("status") Integer status,
										  @Param("canSell") Integer canSell, @Param("now") Date now);

	Integer count(@Param("lineStrategyId") Long lineStrategyId, @Param("status") Integer status, @Param("now") Date now);

	Set<Long> getTrainByDate(@Param("startDate") Date startDate,@Param("endDate") Date endDate,
							 @Param("strategyVoList") List<ListLineStrategyVo> strategyVoList,
							 @Param("operationStatusList") List<Integer> operationStatusList, @Param("now") Date now);

	List<HotLineResp> queryHotLine(@Param("canSell") Integer canSell,@Param("operationStatus") Integer operationStatus);

	Integer selectTrainByLineStrategyId(@Param("trainId") Long trainId, @Param("lineStrategyId") Long lineStrategyId,
										@Param("status") Integer status);

	Integer selectTrainSellByLineStrategyId(@Param("trainId") Long trainId, @Param("canSell") Integer canSell,
											@Param("lineStrategyId") Long lineStrategyId);

	void updateTrainByLineStrategyId(Train train);

	List<Long> listIdByLineStrategyId(@Param("lineStrategyId") Long lineStrategyId);
}
